home *** CD-ROM | disk | FTP | other *** search
/ Aminet 43 / Aminet 43 (2001)(GTI - Schatztruhe)[!][Jun 2001].iso / Aminet / game / patch / WHD_JWSnooker.lha / WHD_JWSnooker / InstallSG < prev    next >
Text File  |  2001-04-06  |  4KB  |  151 lines

  1. ;------------------------------------------------------------------------------------
  2. ; Checks if given program is reachable via the path
  3. ; if not abort install
  4.  
  5. (procedure P_CheckRun (
  6.     (if (<> 0 (run (cat "Which " #VPROGRAM)))
  7.         (abort
  8.             (cat
  9.                 "Could not find the program\n\n"
  10.                 "'" #VPROGRAM "'\n\n"
  11.                 "required to perform the installation!\n\n"
  12.                 "Please install the '" #VPROGRAM "' program ensuring that\n"
  13.                 "it is accessible on the path, then try the installation again."
  14.             )
  15.         )
  16.     )
  17. ))
  18.  
  19.  
  20. ;------------------------------------------------------------------------------------
  21. ; Make save data
  22.  
  23. (procedure P_InstallSave (
  24.     ;
  25.     ; Get save disk inserted
  26.     ;
  27.     (message
  28.         (cat "\n\n\nPlease insert your saved game disk in drive DF0:\n\n"
  29.              "Click 'Proceed' when ready."
  30.         )
  31.     )
  32.  
  33.     ;
  34.     ; Back up any existing save files
  35.     ;
  36.     (set #VT1 (tackon #VDATDIR "SaveDat.6B4"))
  37.     (set #VT2 (tackon #VDATDIR "SaveDat.6B4.old"))
  38.     (if (= 1 (exists #VT1))(
  39.         (if (= 1 (exists #VT2)) (delete #VT2 (optional fail force)) )
  40.         (rename #VT1 #VT2)                  
  41.     ))
  42.  
  43.     (set #VT1 (tackon #VDATDIR "SaveDat.6CA"))
  44.     (set #VT2 (tackon #VDATDIR "SaveDat.6CA.old"))
  45.     (if (= 1 (exists #VT1))(
  46.         (if (= 1 (exists #VT2)) (delete #VT2 (optional fail force)) )
  47.         (rename #VT1 #VT2)                  
  48.     ))
  49.  
  50.     ;
  51.     ; Run the save extractor
  52.     ;
  53.     (set #VOLDEXEDIR @execute-dir)
  54.     (set @execute-dir #VDATDIR)
  55.     (run (cat "RawDIC SLAVE=\"" (tackon #VDATDIR "JWWSMakeSave") "\""))
  56.     (set @execute-dir #VOLDEXEDIR)
  57.  
  58.     ;
  59.     ; Did the save install work?
  60.     ; Check that the files were created
  61.     ;
  62.     (set #VOK 1)
  63.     (if (<>    (getsize (tackon #VDATDIR "SaveDat.6B4")) 5632)
  64.         (set #VOK 0)
  65.     )
  66.     (if (<>    (getsize (tackon #VDATDIR "SaveDat.6CA")) 5632)
  67.         (set #VOK 0)
  68.     )
  69.  
  70.     ;
  71.     ; Restore previous save files if installation failed
  72.     ;
  73.     (if (= 0 #VOK)(
  74.         (set #VT1 (tackon #VDATDIR "SaveDat.6B4"))
  75.         (set #VT2 (tackon #VDATDIR "SaveDat.6B4.old"))
  76.         (if (= 1 (exists #VT2))( (rename #VT2 #VT1) ))
  77.  
  78.         (set #VT1 (tackon #VDATDIR "SaveDat.6CA"))
  79.         (set #VT2 (tackon #VDATDIR "SaveDat.6CA.old"))
  80.         (if (= 1 (exists #VT2))( (rename #VT2 #VT1) ))
  81.  
  82.         (abort (cat "*** Savegame installation failed! ***\n\n"
  83.                     "No existing save positions have been changed"
  84.                )
  85.         )
  86.     ))
  87.  
  88.     (message "\n\n\n\nSavegame installation successful!")
  89. ))
  90.  
  91. ;------------------------------------------------------------------------------------
  92. (welcome "Welcome to the Jimmy White's Whirlwind Snooker Savegame installer")
  93. (set @app-name "Jimmy White's Whirlwind Snooker Savegame")
  94. (set #VOLDEXEDIR @execute-dir)
  95.  
  96. (if    (<> @user-level 2)
  97.     (abort "You must select 'Expert' user level")
  98. )
  99.  
  100. (if    (< @installer-version 2818051)
  101.     (abort "This product requires at least version 43.3 of the Installer program")
  102. )
  103.  
  104. ;
  105. ; Check programs available
  106. ;
  107. (set #VPROGRAM "RawDIC")
  108. (P_CheckRun)
  109.  
  110. (message "\n\nWelcome to the Jimmy White's Whirlwind Snooker Savegame installer"
  111.          "\n© 1998-2001 John Girvin/Halibut Software\n\n"
  112.          "*** YOU MUST HAVE INSTALLED THE GAME BEFORE ***\n"
  113.          "*** ATTEMPTING TO INSTALL ANY SAVED GAMES ! ***\n\n"
  114.          "Please read the documentation thoroughly before"
  115.          " attempting to use this installer!\n\n"
  116.          "This is release 0401.1\n\n"
  117.          "Click 'Proceed' to begin."
  118. )
  119.  
  120. ;
  121. ; Get directory JWWS lives in
  122. ;
  123. (set #VOK 0)
  124. (while (= 0 #VOK)
  125.     (
  126.         (set #VROOTDIR
  127.             (askdir
  128.                 (prompt "Where do you have Jimmy White's Whirlwind Snooker installed?\n"
  129.                         "(select the directory containing the 'Jimmy White Snooker' icon)"
  130.                 )
  131.                 (help @askdir-help)
  132.                 (default @default-dest)
  133.                 (disk)
  134.             )
  135.         )
  136.  
  137.         (if (= 1 (exists (tackon #VROOTDIR "JWWSHD")))
  138.             (set #VOK 1)
  139.         )
  140.     )
  141. )
  142. (set #VDATDIR  (tackon #VROOTDIR "data/"))
  143.  
  144. ;
  145. ; Install the save data
  146. ;
  147. (P_InstallSave)
  148.  
  149. ;================================================================================
  150. ;$VER: JWWS Savegame Installer script R0401.1 © 1998-2001 John Girvin/Halibut Software;================================================================================
  151.